﻿using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Diagnostics;
using System.ComponentModel;
using WPFExcelReport.Helpers;
using System.Windows.Input;
namespace WPFExcelReport
{
    public partial class TBS07
    {
        public TBS07()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VBSFARB();
            this.DataContext = MV;
            InitializeComponent();
        }
       
        public override void LOADBYAUF()
        {
            TBMain.Clear();
            if (ORDERNUM.Length < 32)
                return;
            PM["ART"] = ORDERNUM.Substring(1, 20);
            PM["VAR"] = ORDERNUM.Substring(21, 2);
            PM["FARBE"] = ORDERNUM.Substring(23, 10);
            SResult = TMV.LOADBYKEY(PM);
            MergeData(SResult, true);
            if (ORDERNUM.Length < 32)
                return;
            if (!IsAuto)
                return;
            if (TBMain.Rows.Count > 0)
                return;
            PM["ART"] = ORDERNUM.Substring(1, 20);
            PM["VAR"] = ORDERNUM.Substring(21, 2);
            PM["FARBE"] = ORDERNUM.Substring(23, 10);
            TMV.CREATEBYKEY(PM);
            vwMaster.View.MoveCurrentToFirst();
        }
     
    }
}
